package com.qf.ems.controller;

import com.qf.ems.service.EmpService;
import com.qf.ems.service.impl.EmpServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/manager/safe/deleteEmp")
public class DeleteEmpController extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //1 从请求当中获取参数：id
        Integer id = Integer.valueOf(req.getParameter("id"));
        //2 调用service方法进行删除
        EmpService empService = new EmpServiceImpl();
        empService.deleteEmp(id);
        //3 跳转到详情页面
        resp.sendRedirect(req.getContextPath()+"/manager/safe/showAllEmp");

    }
}
